﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/SiteManage.Master" AutoEventWireup="true" CodeBehind="QuanLiHoaDon.aspx.cs" Inherits="NXBSaiGon.Admin.QuanLiHoaDon" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div style="text-align:center">
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="MaHD" 
        DataSourceID="SqlDataSource1" 
        EmptyDataText="There are no data records to display." ForeColor="#333333" 
        GridLines="None" PageSize="5" Width="907px">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:HyperLinkField DataNavigateUrlFields="MaHD" 
                DataNavigateUrlFormatString="~/Admin/ChiTietHoaDon.aspx?MaHD={0}" 
                DataTextField="MaHD" HeaderText="MaHD" />
            <asp:BoundField DataField="MaKhachHang" HeaderText="MaKhachHang" 
                SortExpression="MaKhachHang" />
            <asp:BoundField DataField="DiaChiHoaDon" HeaderText="DiaChiHoaDon" 
                SortExpression="DiaChiHoaDon" />
            <asp:BoundField DataField="DiaChiGiaoHang" HeaderText="DiaChiGiaoHang" 
                SortExpression="DiaChiGiaoHang" />
            <asp:BoundField DataField="SoDT" HeaderText="SoDT" SortExpression="SoDT" />
            <asp:BoundField DataField="NgayThang" HeaderText="NgayThang" 
                SortExpression="NgayThang" />
            <asp:BoundField DataField="TrangThai" HeaderText="TrangThai" 
                SortExpression="TrangThai" />
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
        </Columns>
        <EditRowStyle BackColor="#7C6F57" />
        <FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#E3EAEB" />
        <SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F8FAFA" />
        <SortedAscendingHeaderStyle BackColor="#246B61" />
        <SortedDescendingCellStyle BackColor="#D4DFE1" />
        <SortedDescendingHeaderStyle BackColor="#15524A" />
    </asp:GridView>
</div>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:NXBSaiGonConnectionString1 %>" 
        DeleteCommand="DELETE FROM [HoaDon] WHERE [MaHD] = @MaHD" 
        InsertCommand="INSERT INTO [HoaDon] ([MaKhachHang], [DiaChiHoaDon], [DiaChiGiaoHang], [SoDT], [NgayThang], [TrangThai]) VALUES (@MaKhachHang, @DiaChiHoaDon, @DiaChiGiaoHang, @SoDT, @NgayThang, @TrangThai)" 
        ProviderName="<%$ ConnectionStrings:NXBSaiGonConnectionString1.ProviderName %>" 
        SelectCommand="SELECT [MaHD], [MaKhachHang], [DiaChiHoaDon], [DiaChiGiaoHang], [SoDT], [NgayThang], [TrangThai] FROM [HoaDon]" 
        UpdateCommand="UPDATE [HoaDon] SET [MaKhachHang] = @MaKhachHang, [DiaChiHoaDon] = @DiaChiHoaDon, [DiaChiGiaoHang] = @DiaChiGiaoHang, [SoDT] = @SoDT, [NgayThang] = @NgayThang, [TrangThai] = @TrangThai WHERE [MaHD] = @MaHD">
        <DeleteParameters>
            <asp:Parameter Name="MaHD" Type="Int32" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="MaKhachHang" Type="Int32" />
            <asp:Parameter Name="DiaChiHoaDon" Type="String" />
            <asp:Parameter Name="DiaChiGiaoHang" Type="String" />
            <asp:Parameter Name="SoDT" Type="String" />
            <asp:Parameter Name="NgayThang" Type="DateTime" />
            <asp:Parameter Name="TrangThai" Type="Int32" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="MaKhachHang" Type="Int32" />
            <asp:Parameter Name="DiaChiHoaDon" Type="String" />
            <asp:Parameter Name="DiaChiGiaoHang" Type="String" />
            <asp:Parameter Name="SoDT" Type="String" />
            <asp:Parameter Name="NgayThang" Type="DateTime" />
            <asp:Parameter Name="TrangThai" Type="Int32" />
            <asp:Parameter Name="MaHD" Type="Int32" />
        </UpdateParameters>
    </asp:SqlDataSource>
</asp:Content>
